<?php
$servername = "localhost";
$username = "username";
$password = "password";

// 创建连接
$conn = new mysqli($servername, $username, $password);

// 检测连接
if ($conn->connect_error) {
    die("连接失败: " . $conn->connect_error);
}

// // 创建连接
// $conn = mysqli_connect($servername, $username, $password);

// // 检测连接
// if (!$conn) {
//     die("Connection failed: " . mysqli_connect_error());
// }

echo "连接成功";

//关闭连接
$conn->close();
?>